import request from '@/config/axios'

export interface Model {
  id: string | undefined
  title: string
  type: number
  content: string
  remark: string
  creator: string
  createTime: Date
}

// 查询公告列表
export const getPage = (params: PageParam) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/notice/notice/page.json',
    params
  })
}

// 查询公告详情
export const getById = (id: string) => {
  return request.get({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/notice/notice/getById.json?id=' + id
  })
}

// 修改公告
export const update = (data: Model) => {
  return request.put({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/notice/notice/update.json',
    data
  })
}

// 删除公告
export const del = (id: string) => {
  return request.delete({
    url: import.meta.env.VITE_BASE_ROLE + '/userCenter/notice/notice/del.json?id=' + id
  })
}
